<template>
	<view>
		<view class="content">
			<view class="banner">
				<u-swiper height="240" :autoplay="false" :list="list"></u-swiper>
			</view>
			<view class="info">
				<view class="jk-flex-between">
					<view class="info_name">
						<text>{{detailInfo.rightsName}}</text>
					</view>
					<view class="nowPrice">
						现价¥
						<text style="font-size: 30rpx; font-weight: bold;">{{detailInfo.rightsPrice}}</text>
					</view>
				</view>
				<view class="jk-flex-between" style="margin-top: 20rpx;">
					<view class="info_other">
						<text>{{detailInfo.isReferralBonuses == 0 ? '有推荐奖励' : '没有推荐奖励'}}</text>
						<text>已售{{detailInfo.sellNumber}}</text>
					</view>
					<view class="price">
						原价¥{{detailInfo.rightsCost}}
					</view>
				</view>
			</view>

			<view class="desInfo">
				<view class="title">
					到期时间
					<text>{{detailInfo.periodValidity}}</text>
				</view>

				<u-line color="#DBDBDB" margin="45rpx 0"></u-line>
				<view>
					<view class="title">
						权益说明
					</view>
					<view class="equityDesBox">
						<view class="row" v-for="(item, index) in detailInfo.giftList" :key="index">
							<text>{{item.couponName}}*{{item.couponNumber}}</text>
							<text>价值{{item.money*item.couponNumber}}元</text>
						</view>
					</view>
				</view>

				<u-line color="#DBDBDB" margin="45rpx 0"></u-line>
				<view>
					<view class="title">
						适用门店
					</view>
					<view class="itemBox">
						<text v-for="(item, index) in detailInfo.activityUnit" :key="index">{{item.storeName}}</text>
					</view>
				</view>

				<u-line color="#DBDBDB" margin="45rpx 0"></u-line>
				<view>
					<view class="title">
						权益详情
					</view>
					<view>
						<u-parse :html="detailInfo.rightsContent"></u-parse>
					</view>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	import {		storeRightsInfo	} from '@/api/marketingB-helper.js';
	export default {
		data() {
			return {
				list: [],
				bizNo: '',
				detailInfo: {}
			}
		},
		onLoad(option) {
			let objParam = JSON.parse(option.param);
			if (objParam.bizNo) {
				this.bizNo = objParam.bizNo;
			}
			this.getData();
		},
		methods: {
			getData() {
				storeRightsInfo({
					bizNo: this.bizNo
				}).then(res => {
					this.detailInfo = res.data;
					if (this.detailInfo.detailImage) {
						var urlPaths = this.detailInfo.detailImage.split(',');
						urlPaths.forEach((item) => {
							let url = this.$imagePath + item;
							this.list.push(url);
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		margin-bottom: 120upx;
	}

	.jk-flex-between {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.info {
		margin: 28rpx;
		padding: 38rpx;
		background: #ffffff;
		border-radius: 12rpx;
		box-shadow: 0 0 68rpx 0 rgba(69, 69, 69, 0.23);

		.info_name {
			text:nth-child(1) {
				font-size: 34rpx;
				font-weight: bold;
				color: #333333;
			}

			text:nth-child(2) {
				margin-left: 12rpx;
				border-radius: 5rpx;
				text-align: center;
				padding: 10rpx 14rpx;
				font-size: 24rpx;
				font-weight: bold;
				color: #ffffff;
				background-color: #FD9808;
			}

		}

		.nowPrice {
			color: #ffffff;
			border-radius: 5rpx;
			padding: 0 14rpx;
			height: 60rpx;
			line-height: 60rpx;
			text-align: center;
			font-size: 20rpx;
			letter-spacing: 1rpx;
			background-color: $main-color;
		}

		.info_other {

			// margin-top: 20rpx;
			text:nth-child(1) {
				font-size: 20rpx;
			}

			text:nth-child(2) {
				margin-left: 12rpx;
				font-size: 20rpx;
				color: #999999;
			}
		}

		.price {
			text-decoration: line-through;
			text-align: right;
			color: #999999;
			font-size: 22rpx;
		}
	}

	.desInfo {
		margin: 28rpx;
		padding: 20rpx 40rpx;

		.title {
			font-size: 28rpx;
			font-weight: bold;
			color: #333333;
			position: relative;

			text {
				position: absolute;
				right: 0;
				top: 0;
				color: #666666;

			}
		}

		.itemBox {
			margin-top: 20rpx;

			text {
				display: block;
				color: #666666;
				font-size: 20rpx;
				margin: 5rpx 0;

				&::before {
					content: '';
					display: inline-block;
					width: 14rpx;
					height: 14rpx;
					line-height: 14rpx;
					border-radius: 10rpx;
					margin-right: 10rpx;
					background-color: #D2D2D2;
				}
			}
		}
		.equityDesBox {
			margin-top: 20rpx;
			.row {
				display: flex;
				justify-content: space-between;
				text:nth-child(1) {
					color: #666666;
					font-size: 20rpx;
					margin: 5rpx 0;
				
					&::before {
						content: '';
						display: inline-block;
						width: 14rpx;
						height: 14rpx;
						line-height: 14rpx;
						border-radius: 10rpx;
						margin-right: 10rpx;
						background-color: #D2D2D2;
					}
				}
				text:nth-child(2) {
					color: #666666;
					font-size: 20rpx;
				}
			}
		}
	}

	.bottomView {
		display: flex;
		width: 100%;
		height: 96upx;
		line-height: 96upx;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 3;
	}

	.btn {
		width: 50%;
		line-height: 100%;
		font-size: 28upx;
		display: flex;
		justify-content: center;
		align-items: center;
		position: relative;
	}

	.leftBtn {
		color: #666;
		background-color: #FFFFFF;
		height: 96upx;
		line-height: 96upx;
		align-self: center;
		text-align: center;
	}

	.rightBtn {
		color: #fff;
	}
</style>
